package com.example.util;

import com.example.domain.PageResult;
import com.github.pagehelper.PageInfo;

/**
 * @author hlc
 * @version 1.0
 * @date 2022/10/22 10:21
 */
public class PageUtil {
    public static <T> PageResult<T> getPageResult(PageInfo<T> pageInfo) {
        PageResult<T> pageResult = new PageResult<>();
        pageResult.setPageNumber(pageInfo.getPageNum());
        pageResult.setPageSize(pageInfo.getPageSize());
        pageResult.setTotalSize(pageInfo.getTotal());
        pageResult.setTotalPages(pageInfo.getPages());
        pageResult.setList(pageInfo.getList());
        return pageResult;
    }
}
